<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsf/composite"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/jsp/WEB/pageLayout.xhtml">
	<ui:define name="centro">

		<h:form id="form">

			<p:growl id="msgs" showDetail="true" />
			<p:panel id="cadSerie" header="Autorização de POS"
				style="width:445px">

				<h:panelGrid id="id1" columns="5" value="#{CadSerieBean.pos}"
					style="margin-top:6px" rowIndexVar="rowIndex">

					<h:outputLabel value="Série*: " />
					<p:inputText value="#{CadSerieBean.pos.serie}" style="width:120px" />

					<p:commandButton id="search" icon="ui-icon-search"
						update="cadSerie" ajax="false"
						title="procurar POS por número de série"
						actionListener="#{CadSerieBean.search}" />

					<h:outputLabel value="Situação : " style="margin-left:25px" />
					<p:selectOneMenu id="Ativo" value="#{CadSerieBean.pos.ativo}"
						style="width:103px" styleClass="dlgTitulo">
						<f:selectItem itemLabel="Ativo" itemValue="true" />
						<f:selectItem itemLabel="Não ativo" itemValue="false" />
					</p:selectOneMenu>

				</h:panelGrid>
				<p:separator></p:separator>

				<h:panelGrid columns="2">
					<p:commandButton id="cad" value="Gravar" update="@all" ajax="false"
						title="Cadastrar/Atualizar POS"
						style="margin-top:3%;margin-left:165px"
						actionListener="#{CadSerieBean.check}" />
				</h:panelGrid>
			</p:panel>
			<table cellpadding="0" cellspacing="0" width="100%" border="0">
				<tr>
					<td height="50" width="180px" valign="bottom" align="left"><p:outputLabel
							value="Total POS Ativos : #{CadSerieBean.totalAtivos.total}" /></td>
					<td height="45" valign="bottom" align="left"><p:outputLabel
							value="Total POS Inativos : #{CadSerieBean.totalInativos.total}" /></td>
				</tr>
			</table>

		</h:form>

		<h:form id="form1">

			<p:dataTable id="tbSerie"
				style="margin-top:6px; max-width: 450px; min-width: 450px"
				widgetVar="relTable" value="#{CadSerieBean.posList}" var="poss"
				rowIndexVar="rowIndex" emptyMessage="Nenhum registro encontrado!"
				paginator="true" rows="20" rowsPerPageTemplate="10,20,30,40,50"
				selectionMode="single" selection="#{CadSerieBean.poss}"
				rowKey="#{poss.serie}" filteredValue="#{CadSerieBean.relFiltrado}">
				<p:ajax event="rowSelect" update=":form:cadSerie"
					listener="#{CadSerieBean.show()}" />

				<p:column headerText="Nº Série"
					style="text-align:center; max-width: 50px; min-width: 50px; overflow: hidden">
					<h:outputText value="#{poss.serie} " />
				</p:column>

				<p:column headerText="Situação"
					style="text-align:center; max-width: 50px; min-width: 50px; overflow: hidden">
					<h:outputText value="Ativo" rendered="#{poss.ativo}" />
					<h:outputText value="Não ativo" rendered="#{not poss.ativo}" />
				</p:column>
				
				<p:column headerText="Data Inclusão" 
					style="text-align:center; 
					max-width: 50px; min-width: 50px; overflow: hidden">
					<h:outputText value="#{poss.dataInclusao}">
						<f:convertDateTime locale="pt_BR" pattern="dd/MM/yyyy" />
					</h:outputText>
				</p:column>
				
				<p:column headerText="Data Alteração" 
					style="text-align:center; 
					max-width: 50px; min-width: 50px; overflow: hidden">
					<h:outputText value="#{poss.dataAlteracao}">
						<f:convertDateTime locale="pt_BR" pattern="dd/MM/yyyy" />
					</h:outputText>
				</p:column>

	
			</p:dataTable>

		</h:form>
	</ui:define>
</ui:decorate>

</html>